#include<pthread.h>
class Mutex
{
public:
    Mutex(pthread_mutex_t* lock)
    :lock_(lock)
    {
        ;
    }
    ~Mutex()
    {
        ;
    }
    void Lock()
    {
        pthread_mutex_lock(lock_);//加锁
    }
    void Unlock()
    {
        pthread_mutex_unlock(lock_);//解锁
    }
private:
    pthread_mutex_t* lock_;
};
class LockGuard
{
public:
    LockGuard(pthread_mutex_t* lock)
    :mt_(lock)
    {
        mt_.Lock();
    }
    ~LockGuard()
    {
        mt_.Unlock();
    }
private:
    Mutex mt_;
}; 